#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 1e4 + 10;
int a[N];
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	int maxx = 0;
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		ans = 0;
		for (int j = i + 1; j < n; j++)
		{
			if (a[j] - a[j - 1] == 1)
				ans++;
			else
				break;
		}
		maxx = max(maxx, ans);
	}
	cout << maxx+1 << endl;
	return 0;
}